package e;
import java.util.Scanner;
public class csz {
        public static void main(String[] args) {
            int answer = (int)(Math.random()*100);

            Scanner input = new Scanner(System.in);
            int times = 0;
            while(true){
                System.out.println("请输一个1-100之间的数字");
                int num = input.nextInt();
                times++;
                if(num < answer){
                    System.out.println("你猜小了");
                }else if(num > answer){
                    System.out.println("你猜大了");
                }else {
                    System.out.println("你猜对了");
                    break;
                }
                if(times == 7){
                    System.out.println("你没有机会继续了");
                    Scanner scan = new Scanner(System.in);
                    System.out.println("是否开始新一轮的游戏？(y/n)");
                    String text = scan.next();
                    if(!text.equalsIgnoreCase("y")){
                        break;
                    }
                }
            }
        }
    }



